#################################################
#    	 MAKEFILE FOR CONVERTOR SERVER		#
#						#
# Autor: Marek Szanyi				#
# Date:  17.1.2010				#
#						#
#################################################


# final product of this makefile
all: convert

# compilator
CCC = g++

# compilator options
CFLAGS  = -O 

# include headers
INCLUDES = -I. -I../Logger/src -I../PComunicator/src/ -I../boost/boost/ -I../pqxx/include/ -I/usr/local/include/libxml2/


# linked libs
LIBS = -L../Logger/lib/ -lLogger -L../PComunicator/lib/ -lPComunicator -L../pqxx/lib/ -lpqxx \
       -L../boost/lib/ -lboost_filesystem -lboost_date_time -lboost_system -lboost_thread -lboost_program_options -lpthread -lxml2 -lz -ldl -lpq\
	   

# the server itself
convert: Client.o CLTConnection.o Server.o SRVConnection.o Plugin.o Psql.o TaskConverter.o \
		 TaskHighlight.o ConvertorManager.o main.o
	$(CCC) $(LIBS) -o convert main.o TaskHighlight.o ConvertorManager.o Factory.o PluginConvertor.o PluginFactory.o Psql.o TaskConvert.o  \
			     	  Client.o CLTConnection.o Server.o SRVConnection.o $(LIBS)

# server parts
main.o:   ./src/main.cpp 
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/main.cpp

ConvertorManager.o: ./src/ConvertorManager.cpp ./src/ConvertorManager.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/ConvertorManager.cpp
	
TaskHighlight.o: ./src/Tasks/TaskHighlight.cpp
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Tasks/TaskHighlight.cpp

TaskConverter.o: ./src/Tasks/TaskConvert.cpp
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Tasks/TaskConvert.cpp

Psql.o: ./src/Psqldb/Psql.cpp 
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Psqldb/Psql.cpp 

Plugin.o: ./src/Plugin/Factory.cpp ./src/Plugin/PluginConvertor.cpp ./src/Plugin/PluginFactory.cpp
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Plugin/Factory.cpp ./src/Plugin/PluginConvertor.cpp \
									./src/Plugin/PluginFactory.cpp
									
Server.o:  ./src/Server/Server.cpp ./src/Server/Server.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Server/Server.cpp

SRVConnection.o: ./src/Server/SRVConnection.cpp ./src/Server/SRVConnection.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Server/SRVConnection.cpp

Client.o: ./src/Client/Client.cpp ./src/Client/Client.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Client/Client.cpp

CLTConnection.o: ./src/Client/CLTConnection.cpp ./src/Client/CLTConnection.h
	$(CCC) $(INCLUDES) $(CFLAGS) -c ./src/Client/CLTConnection.cpp

install: convert
	cp convert ./bin/convert

	echo "******** INSTALATION AND STUFF DONE *************\n\n"
